Skip to content

fix(runtime): redact URL userinfo in command results - #21

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-ffcf
Draft

fix(runtime): redact URL userinfo in command results#21
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/high-severity-issues-ffcf

Conversation

@cursor

@cursor cursor Bot commented Sep 7, 2026

Copy link
Copy Markdown

Bug and impact

Playwright preserves URL userinfo (user:password@host) on page.url() and resolved HTMLAnchorElement.href. Companion/MCP forwarded those strings in navigate/click/type url, snapshot url / htmlSnippet / links[].href, and COMMAND_FAILED messages.

That leaks basic-auth credentials into agent tool output and logs. Distinct from PR #18 (password form fields in ariaSnapshot/page.content) and from PRs #16/#20 (navigate/click SSRF allowlists).

Trigger

  1. navigate to https://user:SECRET@example.com/, then read the command result url or a following snapshot.url.
  2. snapshot a page whose anchors resolve to https://user:SECRET@… — secret appears in links[].href and htmlSnippet.
  3. A failed goto whose Playwright message embeds the credentialed URL.

Live Chromium on HEAD a0fabe3 reproduced (1) and (2) before this change.

Fix

  • Strip userinfo from emitted URLs and free-form snapshot text (packages/runtime/src/url-redact.ts).
  • Omit data: payloads from page.url() so percent-encoded hrefs cannot hide credentials in snapshot.url.
  • Redact userinfo in mapCommandFailure messages.
  • Navigate with userinfo still works for HTTP basic auth; only client-visible results are scrubbed.

Tests

  • packages/runtime/src/url-redact.test.ts
  • Runtime mock test for navigate/snapshot outputs
  • mapCommandFailure userinfo case
  • pnpm --filter @webchain/runtime test:coverage (line coverage 94.36%, threshold 90) and live Chromium re-probe after the fix
Open in Web View Automation 

Playwright page.url() and resolved anchor hrefs preserve basic-auth
credentials, which were forwarded to companion/MCP snapshots and errors.

Co-authored-by: esadrianno <esadrianno@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant